<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<%
    String path = request.getContextPath();
    String CONTEXT_PATH = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	request.setAttribute("base",CONTEXT_PATH);
%>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>系统</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="${base}static/bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="${base}static/dist/css/AdminLTE.min.css">
  <style type="text/css">
    .container{display:table;height:100%;}
    .row{display: table-cell;vertical-align: middle;}
    .login-div{min-width:360px;width:20%;margin:0 auto;}
    .title-h3{line-height: 30px;height: 30px;width: 100%;text-align: center;color:#3c8dbc}
    .form-control{border-radius:3px;}
    .span-img{padding:0px;padding-left:10px;margin:0px;position:absolute;right:1px;top:1px;height:32px;overflow:hidden;border-radius-topright:3px;-moz-border-radius-bottomright:3px;border-left:1px solid #ccc;}
    .box-body{padding-top:0px;}
  </style>
  <script type="text/javascript">
  if (window != top){
		top.location.href ="${base}sysLogin/loginPage"; 
	}
  function refreshImg(){
	  document.getElementById("validImg").src="${base}/jcaptcha.jpg?times="+(new Date());
  }
  function login(){
	  var err=document.getElementById("errorDiv");
	  var form=document.forms[0];
	  if(!form.username.value) err.innerHTML="请输入用户名！";
	 else if(!form.password.value) err.innerHTML="请输入密码！";
	 else if(form.jcaptchaCode!=undefined && form.jcaptchaCode.value=='' ) err.innerHTML="请输入验证码！";
	 else form.submit();
  }  
  </script>
</head>
<body style="height:100%;">
<div class="container">
  <div class="row">
  <div class="box box-primary login-div">
    <!-- /.box-header -->
    <!-- form start -->
    <form role="form" action="" method="post">
      <div class="box-body">
        <h3 class="box-title title-h3">系统登录</h3>
        <div class="form-group" style="position: relative;">
          <input type="text" class="form-control" name="username"  placeholder="用户名" />
        </div>
        <div class="form-group" style="position: relative;">
          <input type="password" class="form-control" name="password" placeholder="密码"/>
        </div>
        <c:if test="${jcaptchaEbabled}">
        <div class="form-group" style="position: relative;">
          <input type="text" class="form-control" placeholder="验证码" name="jcaptchaCode" />
          <span class="span-img"><img src="${base}/jcaptcha.jpg" title="点击刷新" id="validImg" onclick="refreshImg()" /></span>
        </div>
        </c:if>
        <div class="checkbox">
          <label>
            <input type="checkbox"  name="rememberMe" />自动登录
          </label>
        </div>
      <div class="form-group">
       <button type="button"  class="form-control btn btn-primary" onclick="login()">登录</button>
     </div>
     <div class="text-danger" id="errorDiv">${error}</div>
      <!-- /.box-body -->
      </div>
    </form>
  </div>
  </div>
</div>
</body>
</html>